<template>
    <div  >
       <div id="main4" class="Radar" ></div>
    </div>
</template>

<script>
import echarts from 'echarts'
export default {
  name: 'HomeRadar',
  props: {
    schoollevel: Object
  },
  data () {
    return {
    }
  },
  watch: {
    schoollevel: {
      handler: function () {
        this.creatmap()
      },
      deep: true
    }
  },
  mounted () {
    this.creatmap()
  },
  methods: {
    creatmap () {
      var chartDom = document.getElementById('main4')
      var myChart = echarts.init(chartDom)
      var option4

      option4 = {
        tooltip: {
          trigger: 'item'
        },
        legend: {
          top: '5%',
          left: 'center'
        },
        series: [
          {
            name: '访问来源',
            type: 'pie',
            radius: ['40%', '70%'],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: '#fff',
              borderWidth: 2
            },
            label: {
              show: false,
              position: 'center'
            },
            emphasis: {
              label: {
                show: true,
                fontSize: '20',
                fontWeight: 'bold'
              }
            },
            labelLine: {
              show: false
            },
            data: [
              {value: this.schoollevel.top, name: '985'},
              {value: this.schoollevel.middle, name: '211'},
              {value: this.schoollevel.last, name: '双非'}
            ]
          }
        ]
      }

      myChart.setOption(option4)
    }
  }

}
</script>

<style scoped>
.Radar{
    position: absolute;
    width: 300px;
    height: 250px;
    top:500px ;
    left:460px;
}

</style>>
